<{extend name="public/base"}>
<{block name="head_source"}>
<style type="text/css">
    .navigation-intend td:nth-child(1){
        padding-left:20px;
    }
</style>
<{/block}>
<{block name="content"}>

<div class="box">
    <div class="box-header">
        <h3 class="box-title"><{$title}></h3>
    </div>
    <!-- /.box-header -->
    <div class="box-body">

        <div class="row">
            <div class="col-sm-6">
                <a class="btn  btn-primary" href="<{:url('admin/admin/add')}>">
                    新增
                </a>
            </div>

            <!-- search form -->
            <div class="col-sm-6">
                <form method="get" action="">
                    <div class="flex">
                        <label class="flex-label">手机</label>
                        <div class="flex-sub">
                            <div class="flex-input-group">
                                <input type="text" name="username" value="<{if condition='!empty($query.username)'}><{$query.username}><{/if}>" class="flex-input" placeholder="输入手机号码">
                            </div>
                        </div>
                        <label class="flex-label">姓名</label>
                        <div class="flex-sub">
                            <div class="flex-input-group">
                                <input type="text" name="nickname" value="<{if condition='!empty($query.nickname)'}><{$query.nickname}><{/if}>" class="flex-input" placeholder="输入姓名">
                            </div>
                        </div>
                        <label class="flex-label">部门</label>

                        <div class="flex-sub">
                            <div class="flex-input-group">
                                <input type="text" name="department" value="<{if condition='!empty($query.department)'}><{$query.department}><{/if}>" class="flex-input" placeholder="输入部门名称">
                                <span class="">
                                <button type="submit"  id="search-btn" class="btn btn-flat flex-btn"><i class="fa fa-search"></i></button>
                            </span>
                            </div>
                        </div>
                    </div>
                </form>
                <!-- /.search form -->
            </div>
        </div>


        <table id="example1" class="table table-bordered table-striped">
            <thead>
            <tr>
                <{foreach name="column" id="item" key="k"}>
                <th><{$item.name}></th>
                <{/foreach}>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>

            <{volist name="model" id="item"}>
            <tr>
                <{foreach name="column" id="i" key="k"}>
                <td><?php echo  $parser->{$column[$k]['fun']}($item[$k],$column[$k]['options']); ?></td>
                <{/foreach}>
                <td>
                    <a href="<{:url('admin/admin/edit',array('id'=>$item['id']))}>" class="btn btn-primary btn-sm">编辑</a>
                    <a href="javascript:;" data-url="https://xcx.ogmall.com/index/index/index/invite/<{$item.invitecode}>" class="btn btn-primary btn-sm copy_url">推广链接</a>
                    <a href="javascript:;" data-invitecode="<{$item.invitecode}>" class="btn btn-primary btn-sm show_qrcode">推广二维码</a>
                    <a href="<{:url('admin/admin/delete',array('id'=>$item['id']))}>" class="btn btn-danger btn-sm">删除</a>
                </td>
            </tr>
            <{/volist}>


            </tbody>
            <tfoot>
            <tr>
                <{foreach name="column" id="item" key="k"}>
                <th><{$item.name}></th>
                <{/foreach}>
                <th>操作</th>
            </tr>
            </tfoot>
        </table>
        <div><{$model->render()}></div>

    </div>
    <!-- /.box-body -->
</div>



<!-- 弹出框 -->
<div class="modal fade" id="modal">
    <div class="modal-dialog" style="width: auto;" >
        <div class="modal-content" style="width: 300px;margin:0 auto;margin-top:200px;">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" id="modal_title">封面模板</h4>
            </div>
            <div class="modal-body" style="text-align:center;">
                <iframe id="modalIframe" width="280px" height="280px" frameborder="0" scrolling="no"></iframe>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default " data-dismiss="modal">    关  闭    </button>
            </div>
        </div>
    </div>
</div>

<div class="modal fade" id="link_modal">
    <div class="modal-dialog" style="width: auto;" >
        <div class="modal-content" style="width: 500px;margin:0 auto;margin-top:200px;">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title" >推广链接</h4>
            </div>
            <div id="link_content" style="margin:10px;"></div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default " data-dismiss="modal">    关  闭    </button>
            </div>
        </div>
    </div>
</div>
<{/block}>



<{block name="foot_script"}>
<script type="text/javascript">
    $(function(){
        $(".show_qrcode").click(function(){
            var invitecode = $(this).data('invitecode');
            var url = 'https://xcx.ogmall.com/admin/api/getInviteQr/code/'+invitecode;
            $("#modal_title").html("二维码");
            $("#modalIframe").attr('src',url);
            $("#modal").modal();
        });

        $(".copy_url").click(function(){
            var url = $(this).data("url");
            $("#link_content").html(url);
            $("#link_modal").modal();
        });
    });
</script>
<{/block}>
